Computer programs almost always utilize libraries, including library routines and library data. Library routines are operations that are frequently performed by a different programs. Examples of library routines include operations such as PRINT, SAVE, FILE, MULTIPLY, etc. Library data is data which is utilized by different computer programs. Libraries are utilized by including in the computer program calls to library routines and/or library data. Libraries permit the programmer to take advantage of previously-developed routines. Furthermore, changes or improvements to libraries can be implemented by changing one library rather than multiple computer programs.
As used herein, the term "library items" refers collectively to library routines and library data. In prior art systems, when several programs were run on a computer system, it was customary for each program to have its own copy of referenced library items. However, 50 percent or more of a program may be attributable to library items. Thus, when a private copy of the library items is attached to several concurrently running programs, a large memory space may be required.
To alleviate the memory space problem associated with multiple copies of libraries, shared libraries have been utilized. A single copy of the library is shared by all programs that are being run concurrently. Each user program, rather than including copies of the library items, contains pointers to the library items that are used. With only one copy of the library in memory, memory requirements are considerably reduced.
The conventional linking process involves replacing symbolic library references with absolute addresses and creating a disk file containing the executable code. In the past, it was considered impractical to perform linking of libraries to programs at run time since the conventional linking process takes several minutes and would delay the user. Techniques have been developed to speed up the process of linking programs to shared libraries. These techniques usually involve partial linking of the program when it is loaded into memory and completion of linking when the program is run.
According to one known technique, a jump table is associated with the program. The jump table contains the addresses of the library routines that are referenced by the program. A pointer to the appropriate location in the jump table is placed in each library reference in the program. The jump table includes a jump instruction to the corresponding address of the library routine. When the program is loaded, the addresses of library routines are filled in the jump table. When the program is run, each library reference causes a reference to the jump table which in turn executes a jump instruction to the library routine. The disadvantage of this technique is that one or more additional instructions are executed for each library subroutine call, thereby slowing run-time operation of the program. Furthermore, jump tables cannot be used for references to library data. Indirection tables have been utilized for references to library data. However, indirection tables also require execution of additional instructions at run time and degrade run-time performance.
It is a general object of the present invention to provide an improved method for utilizing shared libraries.
It is a further object of the present invention to provide a method for utilizing shared libraries which does not adversely affect run-time performance.
It is yet another object of the present invention to provide a method for utilizing shared libraries in which libraries are rapidly linked to computer programs at run time.
It is still another object of the present invention to provide a method for utilizing shared libraries which does not require modification of the operating system, the compiler or the assembler.